<template>
    <div class="markEditWrap">
        <group>
            <x-textarea style="border: 1px solid #efeff4;border-radius: 8px;" :placeholder="('请输入评分！(保留一位小数)')" :max="200" v-model="scores"></x-textarea>
        </group>
        <div class="btns">
            <button class="green" @click="submitHandle(scores)">确认</button>
            <button class="clearout" @click="scores=''">清空</button>
        </div>
        <myMenu></myMenu>
    </div>
</template>
<script>
import myMenu from '@/commonComponents/menu'
export default {
    name: 'markEdit',
    components: {
        myMenu
    },
    data(){
        return {
            scores: ''
        }
    },
    methods: {
        submitHandle (val) {
            var reg = /^(\d|[1-9]\d)(\.\d)*$|^100$/
            if(!val || val == ''){
                this.$vux.toast.text('请输入评分！')
                return
            }else{
                if(!reg.test(val)){
                    this.$vux.toast.text('请输入0到100的数字（保留一位小数）！')
                    return
                }
            }
            this.$store.state.scores = val;
            this.$router.push('/marks')
        }
    }
}
</script>
<style scoped>
.markEditWrap{
    margin-top: 40px;
}
.btns{
    padding-top: 80px; 
}
.btns .clearout{
    background: #ff7333;
}
</style>
<style>
.markEditWrap .weui-textarea{
    font-size: 18px;
}
</style>
<style>
.markEditWrap .weui-cells:before{
    border: 0;
}
.markEditWrap .weui-cells:after{
    border: 0;
}
.markEditWrap .vux-no-group-title{
    margin: 20px 20px 0;
}
</style>


